package com.example.moduletwo.server;

import com.example.moduletwo.bean.TwoMVPBean;

/**
 * 数据逻辑处理服务
 * Created by sun.li on 2018/6/6.
 *
 * @author sun.li
 */

public class TwoMVPBeanServer {

    private static TwoMVPBeanServer sInstance;

    private int i = 0;
    /**
     * 实例化对象
     *
     * @return
     */
    public static TwoMVPBeanServer getInstance() {
        if (null == sInstance) {
            sInstance = new TwoMVPBeanServer();
        }
        return sInstance;
    }

    public TwoMVPBean disposeBean(TwoMVPBean twoMVPBean,String logo){
        int minSize = 100;
        int maxSize = 200;
        String logoStr = "Activity";
        if(logo.contains("ActivityOne")){
            minSize = 300;
            maxSize = 400;
            logoStr = "ActivityOne";
        }else if(logo.contains("Fragment")){
            minSize = 500;
            maxSize = 600;
            logoStr = "Fragment";
        }
        if (logo.contains("1")) {
            i = 0;
        } else if (logo.contains("2")) {
            if (i < minSize || i > maxSize) {
                i = minSize;
            }
        } else if (logo.contains("3")) {
            if (i > minSize && i < maxSize) {
                i = maxSize;
            }
        }
        i++;
        int one = i + 1;
        int two = i + 2;
        if (null == twoMVPBean) {
            twoMVPBean = new TwoMVPBean();
        }
        twoMVPBean.setStr1(one + "_"+logoStr);
        twoMVPBean.setStr2(two + "_"+logoStr);
        return twoMVPBean;
    }
}
